<!DOCTYPE html>
<html lang="en">
<include file="./Application/Home/View/Layout/head.html" />

        <link href="__PUBLIC__/assets/bootstrap/css/select2.css" rel="stylesheet" />
        <link href="__PUBLIC__/assets/bootstrap/css/jquery.dataTables.min.css" rel="stylesheet">
               <style type="text/css">
        .loadEffect{
    width: 100px;
    height: 100px;
    position: relative;
    margin: 0 auto;
  display:none;
 }
 .loadEffect span{
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: lightgreen;
    position: absolute;
    -webkit-animation: load 1.04s ease infinite;
 }
 @-webkit-keyframes load{
    0%{
       opacity: 1;
    }
    100%{
       opacity: 0.2;
    }
 }
 .loadEffect span:nth-child(1){
    left: 0;
    top: 50%;
    margin-top:-8px;
    -webkit-animation-delay:0.13s;
 }
 .loadEffect span:nth-child(2){
    left: 14px;
    top: 14px;
    -webkit-animation-delay:0.26s;
 }
 .loadEffect span:nth-child(3){
    left: 50%;
    top: 0;
    margin-left: -8px;
    -webkit-animation-delay:0.39s;
 }
 .loadEffect span:nth-child(4){
    top: 14px;
    right:14px;
    -webkit-animation-delay:0.52s;
 }
 .loadEffect span:nth-child(5){
    right: 0;
    top: 50%;
    margin-top:-8px;
    -webkit-animation-delay:0.65s;
 }
 .loadEffect span:nth-child(6){
    right: 14px;
    bottom:14px;
    -webkit-animation-delay:0.78s;
 }
 .loadEffect span:nth-child(7){
    bottom: 0;
    left: 50%;
    margin-left: -8px;
    -webkit-animation-delay:0.91s;
 }
 .loadEffect span:nth-child(8){
    bottom: 14px;
    left: 14px;
    -webkit-animation-delay:1.04s;
 }
  .Alertmessage{
  text-align: center;
    color: red;
 }
</style>
    <body>
        <block name="header">
           <include file="block/header"/>
        </block>
        <section>
            <div class="mainwrapper">
			   <block name="left">
			   <include file="block/left" />
               </block>

                <div class="mainpanel">
                    <div class="contentpanel">
                       <form name="form1" id="form1" action="" method="post" onsubmit="return submitCheck(<?php echo canManage(); ?>)">
                        <div class="panel panel-title-head">
                        <div class="search_banner">
                             <div class="pull-left col-md-1">
	                                <a class="btn btn-info btn-large active" href="{:U('home/System/channelParameter')}">普通参数</a>
	                          </div>
	                          <div class="pull-left col-md-1">
	                                <a class="btn btn-info btn-large" href="{:U('home/System/paramsChannel')}">高级参数</a>
	                          </div>
                             <div class="pull-left col-md-1">
	                                 <span class="btn btn-info btn-large downloadPeizhi">导出配置</span>
	                          </div>
	                          <div class="pull-left col-md-1">
	                                <a class="btn btn-info btn-large" href="{:U('home/System/backupUpload/type/channel')}">恢复配置</a>
	                          </div>
	                          <div style="clear:both"></div>
                         </div>
                         <ul id="myTab" class="nav nav-tabs">
                            <foreach name="channeltypelist" item="type">
								<li <if condition="$type.n_channeltype eq $channeltype"> class="active" </if>>
									<a href="/home/System/channelParameter/type/{$type.n_channeltype}"  >
										 {$type.typename}
									</a>
								</li>
							</foreach>
						</ul>
						<div class="table-responsive" style="max-height: 650px;">
                            <table id="basicTable" class="table table-striped table-bordered responsive">
                                <thead class="">
                                    <tr>
                                        <th style="width: 100px;">通道编号</th>
                                        <foreach name="rsTitle" item="titlelist">
                                           <th>{$titlelist.v_paramsnamech}</th>
                                           <input name="clo_name[]" type="hidden" value="{$titlelist.v_paramsname}" />
                                        </foreach>
                                    </tr>
                                </thead>

                                <tbody>
                                <foreach name="rs" item="list" key="k">
                                  <tr role="row" >
                                  	  <td>{$list.n_channelno}<input name="n_channelno[]" type="hidden" value="{$list.n_channelno}" /></td>
                                      <foreach name="list" item="list2" key="k2">
                                        <if condition="$k2 neq 'n_channelno'">
                                      	  <td>{$list.$k2.input}</td>
                                        </if>
                                	  </foreach>
                                  </tr>
                                 </foreach>
                                </tbody>
                            </table>
                         </div>
                        </div><!-- panel -->
                        <div class=" col-md-12">
	                                <input class="btn btn-info btn-large" type="submit" value="提交参数">
	                    </div>

                        </form>

                        </div><!-- panel -->


                    </div><!-- contentpanel -->
                </div><!-- mainpanel --><!-- mainpanel -->
            </div><!-- mainwrapper -->


     <!-- 告警模态框 -->
    <div class="modal fade" id="alertModel" tabindex="-1" role="dialog" aria-labelledby="myAlert">
      <div class="modal-dialog" role="document" style="width:450px">
        <div class="modal-content" >
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="myAlert" style="text-align: center;">提示</h4>
          </div>
          <div class="modal-body">
            <div class="inner">
              <h4 class="Alertmessage"> </h4>
            </div>
            <div class="loadEffect">
             <span></span>
             <span></span>
             <span></span>
             <span></span>
             <span></span>
             <span></span>
             <span></span>
             <span></span>
        </div>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            <button type="button" class="btn btn-primary sureDel" data-dismiss="modal">确定</button>
          </div>
        </div>
      </div>
    </div>


        </section>


        <script src="__PUBLIC__/assets/bootstrap/js/bootstrap.min.js"></script>
        <script src="__PUBLIC__/assets/bootstrap/js/custom.js"></script>

  <script>
      $(document).ready( function () {
          var canManage = "{$canManage}";
          if (canManage == 0) {
              $('#alertModel2').modal('show');
              $('.Alertmessage').html('没有管理权限，请联系管理员')
              return;
          }
      })

      $('.downloadPeizhi').click(function(){
          var canManage = "{$canManage}";
          if(canManage == 0){
              $('#alertModel2').modal('show');
              $('.Alertmessage').html('没有管理权限，请联系管理员')
              return;
          }
      $('#alertModel').modal('show');
      $('.downloadName').css("display","none");
      var url="{:U('home/System/down_channelParameter')}"
      var Items
      $.ajax({
        type:"POST",
        url:url,
        data:{
          strID:Items
        },
        beforeSend:function(XMLHttpRequest){
          $('.loadEffect').css("display","block");
        },
        success: function(data){
          console.log(data)
          $('.loadEffect').css("display","none");
          $('.downloadName').css("display","block");
          $('.modal-title').html("操作完成");
          $('.Alertmessage').html("成功导出配置：<a href='"+data.data+"'>点击下载</a>")
        }
      })
    })

    var videoinput =  $("input[name^='IsVideoChannel_']");
    videoinput.click(function(){
        var videoNum = "{$videoNum}";
        if(videoNum==''){
          videoNum = 16
        }
        var num = 0;
        $("input:checkbox[name^='IsVideoChannel_']:checked").each(function(k){
            num ++
        })
        if(num > videoNum){

           if($(this).is(':checked')){
              alert("最多只能选择"+videoNum+"通道录像");return false;
           }

        }
    })


 function submitCheck(flag){
  if(!flag){
    $('#alertModel').modal('show');
    $('.Alertmessage').html('无权操作，请与管理员联系')
    return false;
    }

 }

  </script>

    </body>
</html>
